﻿//using System;
//using System.ServiceModel;
//using System.ServiceModel.Channels;
//using System.ServiceModel.Dispatcher;
///// <summary>
///// Custom call context initializer added to all WCF operations such that each operation outputs
/////  a log message before and after invocation.
///// </summary>
//public class OperationLoggingCallContextInitializer : ICallContextInitializer
//{
//    private readonly ILogger logger;
//    private readonly string operationName;
//    private readonly string contractName;
//    public OperationLoggingCallContextInitializer(ILogger logger, string operationName, string contractName)
//    {
//        this.logger = logger;
//        this.operationName = operationName;
//        this.contractName = contractName;
//    }
//    public object BeforeInvoke(InstanceContext instanceContext, IClientChannel channel, Message message)
//    {
//        this.logger.DebugFormat("BeforeInvoke {0}.{1}", this.contractName, this.operationName);
//        return null;
//    }
//    public void AfterInvoke(object correlationState)
//    {
//        this.logger.DebugFormat("AfterInvoke {0}.{1}", this.contractName, this.operationName);
//    }
//}